Skip to content

[Repo Assist] fix(httputil): remove duplicate TLS declarations#7878

Merged
lpcox merged 1 commit into
mainfrom
repo-assist/fix-tls-duplicate-7862-746d9a688288cde4
Jun 21, 2026
Merged

[Repo Assist] fix(httputil): remove duplicate TLS declarations#7878
lpcox merged 1 commit into
mainfrom
repo-assist/fix-tls-duplicate-7862-746d9a688288cde4

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

🤖 This PR is from Repo Assist, an automated AI assistant for this repository.

Closes #7862

Root Cause

After PR #7834 was merged (which introduced internal/httputil/tls.go), a second file internal/httputil/tls_config.go was added to the same package with identical declarations for MinTLSVersion, NewServerTLSConfig, and NewClientTLSConfig. Go does not permit two files in the same package to define the same exported identifiers — this causes a compile error:

internal/httputil/tls_config.go:7:7: MinTLSVersion redeclared in this block
internal/httputil/tls_config.go:11:6: NewServerTLSConfig redeclared in this block
internal/httputil/tls_config.go:20:6: NewClientTLSConfig redeclared in this block

Fix

  • Delete internal/httputil/tls_config.gotls.go is kept as it has more detailed godoc
  • Delete internal/httputil/tls_config_test.gotls_test.go is kept
  • Absorb assert.NotNil checks from tls_config_test.go into tls_test.go so no test coverage is lost

No production logic changes — only the duplicate file is removed.

Test Status

⚠️ Infrastructure note: proxy.golang.org is blocked by the environment firewall, preventing go build ./... and go test ./....

Manual verification performed:

  • go tool compile -e internal/httputil/tls.go — after removing tls_config.go, no redeclaration errors remain (only the expected "could not import crypto/tls" from the isolated invocation context)
  • gofmt -d internal/httputil/tls.go internal/httputil/tls_test.go — clean, no diffs
  • Both files are syntactically valid Go

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • proxy.golang.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "proxy.golang.org"

See Network Configuration for more information.

Generated by Repo Assist · 1.2K AIC · ⊞ 45.3K ·
Comment /repo-assist to run again

Add this agentic workflows to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@851905c06e905bf362a9f6cc54f912e3df747d55

tls_config.go and tls_config_test.go both redeclared MinTLSVersion,
NewServerTLSConfig, and NewClientTLSConfig that are already defined in
tls.go and tls_test.go — causing a compile error.

Keep tls.go (has more detailed godoc) and tls_test.go. Absorb the
assert.NotNil checks from tls_config_test.go into tls_test.go before
deleting the duplicate files.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lpcox lpcox marked this pull request as ready for review June 21, 2026 15:56
Copilot AI review requested due to automatic review settings June 21, 2026 15:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR resolves a Go compile-time redeclaration failure in internal/httputil by removing the duplicate TLS helper implementation and its duplicate tests, leaving a single authoritative tls.go/tls_test.go pair.

Changes:

  • Delete internal/httputil/tls_config.go, which duplicated exported TLS declarations already present in internal/httputil/tls.go.
  • Delete internal/httputil/tls_config_test.go, which duplicated test function declarations.
  • Preserve test coverage by adding assert.NotNil checks into internal/httputil/tls_test.go.
Show a summary per file
File Description
internal/httputil/tls_test.go Adds assert.NotNil assertions so coverage from the removed duplicate test file is retained.
internal/httputil/tls_config.go Deleted to remove duplicate exported TLS identifiers that caused redeclaration compile errors.
internal/httputil/tls_config_test.go Deleted to remove duplicate test function declarations that also caused redeclaration errors.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 3/3 changed files
  • Comments generated: 0

@lpcox lpcox merged commit 9708740 into main Jun 21, 2026
24 checks passed
@lpcox lpcox deleted the repo-assist/fix-tls-duplicate-7862-746d9a688288cde4 branch June 21, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[duplicate-code] Duplicate Code Pattern: Exact TLS declarations in internal/httputil package

2 participants